<div class="parent">
    <div class="child">测试示例</div>
  </div>
  <style>
    .parent {
      height: 100px;
      background-color: aqua;

      display:flex;
      height: 100%;
      justify-content: center;  /*水平居中*/
      align-items: center;      /*垂直居中*/
      
    }
    .child {
      background-color: blueviolet;

     
    }
  </style>